package com.ytjj.qmyx.admin.controller;

import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.model.request.BankerInfoRequest;
import com.ytjj.qmyx.admin.service.BankerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 
 *
 * @Version: 1.0
 *
 * 供应商资质 模块
 */
@RestController
@RequestMapping("/bankerInfo")
public class BankerInfoController {

    @Autowired
    private BankerInfoService bankerInfoService;

    @PostMapping("/list")
    @OperLog(operModule = "供应商资质模块", operDesc = "资质列表", operType = SysLogConstants.OPERATION_SELECT)
    public String selectList(@RequestBody BankerInfoRequest bankerInfoRequest) {
        return bankerInfoService.newSelectList(bankerInfoRequest);
    }

    @GetMapping("/selectIdentity")
    @OperLog(operModule = "身份证信息", operDesc = "查询", operType = SysLogConstants.OPERATION_SELECT)
    public String selectIdentity(Integer id) {
        return bankerInfoService.newSelectIdentity(id);
    }

    @PostMapping("/verifySuccess")
    @OperLog(operModule = "供应商资质模块", operDesc = "审核成功", operType = SysLogConstants.OPERATION_UPDATE)
    public String verifySuccess(@RequestBody BankerInfoRequest bankerInfoRequest) {
        return bankerInfoService.newVerifySuccess(bankerInfoRequest);
//        Integer count = bankerInfoService.verifySuccess(bankerInfoRequest.getId());
//        if(count > 0) {
//            return CommonResult.success(count);
//        } else {
//            return CommonResult.failed();
//        }
    }

    @PostMapping("/verifyFail")
    @OperLog(operModule = "供应商资质模块", operDesc = "审核失败", operType = SysLogConstants.OPERATION_UPDATE)
    public String verifyFail(@RequestBody BankerInfoRequest bankerInfoRequest) {
        return bankerInfoService.newVerifyFail(bankerInfoRequest);
//        Integer count = bankerInfoService.verifyFail(bankerInfoRequest.getId(), bankerInfoRequest.getRejectReason());
//        if(count > 0) {
//            return CommonResult.success(count);
//        } else {
//            return CommonResult.failed();
//        }
    }
}
